package com.barbeque.mall.exception;

import com.barbeque.mall.bean.BaseRespVoNoData;
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author Euphonium
 * @since 2022/07/18
 */
@RestControllerAdvice
public class ValidationExceptionControllerAdvice {

    @ExceptionHandler(ValidationException.class)
    public BaseRespVoNoData validationException(ValidationException exception) {
        String message = exception.getMessage();
        System.out.println(message);
        return BaseRespVoNoData.error(401, "参数不对");
    }

}
